package com.xumx.demo.service;

import com.xumx.demo.pojo.MethodLogEntity;
import com.xumx.demo.repository.MethodLogRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 日志服务类，处理日志存储逻辑
 */
@Service
public class MethodLogService {

    private final MethodLogRepository logRepository;

    @Autowired
    public MethodLogService(MethodLogRepository logRepository) {
        this.logRepository = logRepository;
    }

    /**
     * 保存日志到数据库
     */
    @Transactional
    public void saveLog(MethodLogEntity logEntity) {
        logRepository.save(logEntity);
    }
}
